﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel;
using System.Data.Objects.DataClasses;
using SCMS.CoreBusinessLogic._GoodsReceivedNote;
using System.ComponentModel.DataAnnotations;

namespace SCMS.UI.Models
{
    public class GRNote
    {
        public Model.GoodsReceivedNote EntityGRN { get; set; }

        [Required]
        public Guid PurchaseOrderId 
        {
            get { return EntityGRN.PurchaseOrderId; }
            set { EntityGRN.PurchaseOrderId = value; }
        }

        [Required]
        public Guid ReceivedBy
        {
            get { return EntityGRN.ReceivedBy; }
            set { EntityGRN.ReceivedBy = value; }
        }

        [Required]
        public Guid CountryOfficeId 
        {
            get { return EntityGRN.CountryOfficeId; }
            set { EntityGRN.CountryOfficeId = value; }
        }

        [Required]
        public string DeliveredBy
        {
            get { return EntityGRN.DeliveredBy; }
            set { EntityGRN.DeliveredBy = value; }
        }

        [Required]
        public string DeliveryCompany
        {
            get { return EntityGRN.DeliveryCompany; }
            set { EntityGRN.DeliveryCompany = value; }
        }

        [Required]
        public string VehicleRegNumber
        {
            get { return EntityGRN.VehicleRegNumber; }
            set { EntityGRN.VehicleRegNumber = value; }
        }

        [Required]
        public string DriverLicenseNumber
        {
            get { return EntityGRN.DriverLicenseNumber; }
            set { EntityGRN.DriverLicenseNumber = value; }
        }

        [Required]
        public string DnNumber
        {
            get { return EntityGRN.DnNumber; }
            set { EntityGRN.DnNumber = value; }
        }

        [Required]
        public Guid? ApproverId
        {
            get { return EntityGRN.ReceptionApprovedBy; }
            set { EntityGRN.ReceptionApprovedBy = value; }
        }

        public SelectList ApproversList { get; set; }

        public List<POItemsView> POItemz { get; set; }

        public SelectList staffs { get; set; }

        public SelectList SubOffices { get; set; }

        public SelectList PurchaseOrders { get; set; }

        public SelectList Warehouses { get; set; }
    }

    public class GRNoteItem
    {
        public Model.GoodsReceivedNoteItem EntityGRNItem { get; set; }

        public SelectList POItems { get; set; }
    }

    public class GRNItems
    {
        public Model.GoodsReceivedNoteItem EntityGRNItem { get; set; }
    }

    public class ViewGRN
    {
        public Model.GoodsReceivedNote EntityGRN { get; set; }

        public Model.VStaffDetail ReceivedBy { get; set; }

        public bool CanApprove { get; set; }
    }

    public class VerifyGRN
    {
        public Model.GoodsReceivedNote EntityGRN { get; set; }

        public List<Model.GoodsReceivedNoteItem> ItemColl { get; set; }
        //public List<Item2Verify> ItemColl { get; set; }

        public Model.VStaffDetail ReceivedBy { get; set; }
    }

    //public class Item2Verify
    //{
    //    public Guid Id { get; set; }
    //    [Required(ErrorMessage = "Required Field")]
    //    public decimal QuantityDelivered { get; set; }
    //    [Required(ErrorMessage = "Required Field")]
    //    public decimal QuantityDamaged { get; set; }
    //}

    public class GRNDetailsParams
    {
        public bool Verify { get; set; }
        public Guid GRNId { get; set; }
    }

    public class RegisterAsset
    {
        public Model.Asset EntityAsset { get; set; }

        public SelectList ProjectDonors { get; set; }

        public SelectList Warehouses { get; set; }

        public SelectList Items { get; set; }

        [DisplayName("Asset Picture")]
        public string AssetPicture { get; set; }
        public HttpPostedFileBase AssetPictureUpload { get; set; }

        public SelectList Currencies { get; set; }

        public Guid ProjectId { get; set; }

        public SelectList Projects { get; set; }
        
    }

    public class RegisteredAsset
    {
        public List<Model.GoodsReceivedNoteItem> EntityAsset { get; set; }
    }

    public class OtherConsumables
    {
        public Model.Inventory EntityInventory { get; set; }

        public List<Model.Inventory> Inventories { get; set; }

        public SelectList Items { get; set; }
        public SelectList Warehouses { get; set; }

        [Required]
        public Guid ItemId
        {
            get { return EntityInventory.ItemId; }
            set { EntityInventory.ItemId = value; }
        }

        [Required]
        public long Quantity
        {
            get { return EntityInventory.Quantity; }
            set { EntityInventory.Quantity = value; }
        }

        [Required]
        public Guid Warehouse
        {
            get { return EntityInventory.WareHouseId; }
            set { EntityInventory.WareHouseId = value; }
        }
    }


}